﻿@model IEnumerable<MerchantTribe.Commerce.Contacts.Address>

@{  
    Layout = "~/Areas/account/Views/Shared/_AccountLayout.cshtml";
}

@Html.Raw((string)TempData["messages"])
<h1>Address Book</h1>
    <a href="@Url.Action("Edit", new { id="new" })" alt="Add New Address"><img src="@ViewBag.AddNewButtonUrl" alt="Add New Address" /></a>
    <h2>@Model.Count().ToString() addresses found</h2>
    <div class="addressbookwrapper">
    @foreach (MerchantTribe.Commerce.Contacts.Address a in Model)
    {
        <div class="address">
            <span class="BVSmallText">@Html.Raw(a.ToHtmlString())</span>
            <div class="buttonrow">
                <table border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td><a href="@Url.Action("Edit", new { id=@a.Bvin })"><img src="@ViewBag.EditButtonUrl" alt="Edit" border="0" /></a></td>
                    <td><form action="@Url.Action("Delete", new { id=@a.Bvin })" method="post"><input type="image" src="@ViewBag.DeleteButtonUrl" alt="Delete" onclick="return window.confirm('Delete this address?');" /></form></td>
                </tr>
                </table>                                
            </div>            
        </div>
    }
    </div>